package carImplements;

import interfaces.IAssemblyLine;
import interfaces.ILineStep;
import interfaces.IProduct;

public class CarAssemblyLine implements IAssemblyLine {
	
	private ILineStep firstStep;
	public ILineStep getfirstStep(){
		return firstStep;
	}

	private ILineStep secondStep;
	public ILineStep getSecondStep(){
		return secondStep;
	}
	
	private ILineStep thirdStep;
	public ILineStep getThirdStep(){
		return thirdStep;
	}

	public CarAssemblyLine(ILineStep firstStep, ILineStep secondStep, ILineStep thirdStep) {
		
		super();
		
		this.firstStep = firstStep;
		this.secondStep = secondStep;
		this.thirdStep = thirdStep;
		
		System.out.println("Create an assembly line of cars from 3 steps");
	}

	@Override
	public IProduct assemblyProduct(IProduct product) {
		
		System.out.println("Starting build cars");
		
		product.installFirstPart(firstStep.buildProductPart());
		product.installSecondPart(secondStep.buildProductPart());
		product.installThirdPart(thirdStep.buildProductPart());
		
		System.out.println("Completion of the assembly of car");
		return product;
	}

}
